import { useEffect } from "react";
import { useLocation } from "react-router-dom";
import { disableDevTools } from "@/utils/disableDevTools";

function useDisableDevTools() {
  const location = useLocation();

  useEffect(() => {
    if (
      location.pathname.includes("login") &&
      import.meta.env.VITE_DEVTOOLS_OPEN === "true"
    ) {
      const clean = disableDevTools();
      return clean;
    }
  }, [location.pathname]);
}

export default useDisableDevTools;
